import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/sequelize';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { nest } from '../db/modal/nest.entity';
import { nesttest } from '../db/modal/nesttest.entity';
import { GoodsMaterial } from '../db/modal/goods.entity';

@Injectable()
export class NestjsService {
  constructor(
    @InjectRepository(nest, 'nest')
    private nestRepository: Repository<nest>,
    @InjectRepository(nesttest, 'nest')
    private nesttestRepository: Repository<nesttest>,
    @InjectRepository(GoodsMaterial)
    private goodsMaterialRepository: Repository<nest>,
  ) {}
  save(obj: any) {
    return this.nestRepository.save(obj);
  }

  find(id: any) {
    return this.nestRepository.findOne({ where: { id } });
  }

  savetest(obj: any) {
    return this.nesttestRepository.save(obj);
  }

  findtest(id: any) {
    return this.nesttestRepository.findOne({ where: { id } });
  }

  findList() {
    return this.goodsMaterialRepository.find();
  }
}
